/*
ID:luongho3
LANG:JAVA
TASK:buylow
 */
import java.io.File;
import java.io.PrintStream;
import java.math.BigInteger;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class buylow {
	
	public int nDays;
	public int[] price;
	public int len;
	public BigInteger nSol;

	public static void main(String[] args) throws Exception {

		buylow prob = new buylow();
		
		prob.read();
		prob.solve();
		prob.write();
	}
	
	public void read() throws Exception {
		Scanner scanner = new Scanner(new File("buylow.in"));
		nDays = scanner.nextInt();
		price = new int[nDays+1];
		for (int i=1;i<=nDays;++i) {
			price[i] = scanner.nextInt();
		}
	}
	
	public void solve() {
		
		int[] lenAt = new int[nDays+1];
		lenAt[0] = 0;
		len = 1;
		nSol = BigInteger.ZERO;
		
		BigInteger[] count = new BigInteger[nDays+1];
		
		for (int i=1;i<=nDays;++i) {
			for (int j=i-1;j>=0;--j) {
				if (j != 0) {
					if (price[j] > price[i]) {
						lenAt[i] = max(lenAt[i], lenAt[j] + 1);
					}
				}
				else if (j == 0) {
					lenAt[i] = max(lenAt[i], 1);
				}
				len = max(lenAt[i], len);
			}
		}
		
		Set<Integer> set = new HashSet<Integer>();
		
		for (int i=1;i<=nDays;++i) {
			if (lenAt[i] == 1) {
				count[i] = BigInteger.ONE;
			}
			else {
				count[i] = BigInteger.ZERO;
				Set<Integer> s = new HashSet<Integer>();
				for (int j=i-1;j>=0;--j) { 
					if (price[j] > price[i]) {
						if (lenAt[j] + 1 == lenAt[i]) {
							if (!s.contains(price[j])) {
								count[i] = count[i].add(count[j]);
								s.add(price[j]);
							}
						}
					}
				}
			}

		}
		for (int i=nDays;i>=1;--i) {
			if (lenAt[i] == len) {
				if (!set.contains(price[i])) {
					nSol = nSol.add(count[i]);
					set.add(price[i]);
				}
			}
		}
	}
	
	public static int max(int a, int b) {
		return a > b ? a : b;
	}
	
	public void write() throws Exception {
		PrintStream ps = new PrintStream(new File("buylow.out"));
		System.setOut(ps);
		System.out.println(len + " " + nSol);
		ps.close();
	}

}
